package crudfx.container;
import crudfx.interop.*;
import crudfx.data.*;
import javax.swing.*;
import javax.swing.border.*;
import javafx.scene.paint.*;
/**
 * @profile desktop
 * @author Sergey Surikov
 */
public class Columns extends UIComponent{
    var panel:JamTop;
    public var content:UIComponent[] on replace {setColumns();};
    var rows:JamLeft;
    function setColumns(){
        rows=JamLeft{};
        var o:JamLeft=rows;
        var i:JamLeft;
        for(c:UIComponent in content){
            o.jam=c;
            i=JamLeft{};
            o.content=i;
            o=i;
            }
        }
    init{
        setColumns();
        panel=JamTop{
            content:bind rows
            }
        }
    override public function getJComponent():JComponent{
        return panel.getJComponent();
        }
    override public function highlight(s:String):Boolean{
        for(c:UIComponent in content){
            if(c.highlight(s))return true;
            }
        return false;
        }
    override public function gather():DataTree{
        var me:DataTree=DataTree{ name:"Columns" };
        for(c:UIComponent in content) insert c.gather() into me.node("content").children;
        return me;
        }
    }
